package com.usian.feign;


import com.usian.pojo.TbItem;
import com.usian.pojo.TbItemCat;
import com.usian.pojo.TbItemParam;
import com.usian.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient("usian-item-service")
public interface ItemServiceFeign {
    @RequestMapping("service/selectItemInfo")
    TbItem selectItemInfo(@RequestParam Long itemId);


    @RequestMapping("/service/item/selectTbItemAllByPage")
    PageResult selectTbItemAllByPage(@RequestParam Integer page,
                                     @RequestParam Integer rows);
    @RequestMapping("/service/itemCategory/selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam(defaultValue = "0") Long id);

    @RequestMapping("service/itemParam/selectItemParamByItemCatId/{itemCatId}")
    TbItemParam selectItemParamByItemCatId(@PathVariable Long itemCatId);

    @RequestMapping("/service/item/insertTbItem")
    Integer insertTbItem(@RequestBody TbItem tbItem, @RequestParam String desc, @RequestParam String itemParams);

    @PostMapping("/service/item/deleteItemById")
    Integer deleteItemById(@RequestParam Long itemId);
    //删除主键
    @PostMapping("/service/item/delete")
    Integer delete(@RequestParam Long itemId);
    //回显
    @PostMapping("/service/item/findById")
    Map<String, Object> findById(@RequestParam Long itemId);

    @RequestMapping("/service/item/updateTbItem")
    Integer update(@RequestBody TbItem tbItem, @RequestParam String desc, @RequestParam String itemParams);

    @RequestMapping("/service/itemParam/selectItemParamAll")
    PageResult selectItemParamAll();

    //规格添加
    @RequestMapping("/service/itemParam/insertItemParam")
    Integer insertItemParam(@RequestBody TbItemParam itemParam);

    //删除规格
    @RequestMapping("/service/itemParam/deleteItemParamById")
    Integer deleteItemParamById(@RequestParam Long id);
}
